﻿<%@ Page Title="Change Password" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="changepassword.aspx.cs" Inherits="user_changepassword" %>

<asp:Content ID="Content2" ContentPlaceHolderID="cpHeader" runat="Server">

    <script src="/includes/ValidationError-NEW.js" type="text/javascript"></script>

    <script src="/includes/ValidationEffect-NEW.js" type="text/javascript"></script>

</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cpBody" runat="Server">
    <div id="container">
        <div class="body">
            <div class="topcol">
            </div>
            <div class="body">
                <div class="padding_lr15px">
                    <!--Column Content | Start-->
                    <div class="col_content">
                        <div class="topcol">
                        </div>
                        <div class="body">
                            <div class="padding_lr30px">
                                    <asp:Label runat="server" CssClass="tx_title21 uppercase" ID="lblChangePassword" Text="<%$Resources:Menu,ChangePassword%>" />:
                                <div class="seperator_15px">
                                </div>
                                <div id="CarForm">
                                    <div>
                                        <asp:Label ID="lblMessage" ForeColor="Red" runat="server"></asp:Label>
                                        <asp:ValidationSummary ID="ValidationSummary1" CssClass="errorSummary" HeaderText="<%$ Resources:Menu,RequiredField%>"
                                            runat="server" ValidationGroup="customer" />
                                    </div>
                                    <!--Form | Start-->
                                    <asp:Panel runat="server" ID="pnlChangePassword" DefaultButton="btnSubmit">
                                        <div>
                                            <div class="form_col_1 comp left tx_form">
                                                <%=GetGlobalResourceObject("Menu", "CurrentPassword")%></div>
                                            <div class="form_col_2 left">
                                                <asp:TextBox ID="txtOldPassword" runat="server" TextMode="Password" MaxLength="20"
                                                    Width="230px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvOldPassword" runat="server" ControlToValidate="txtOldPassword"
                                                    validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                                    ValidationGroup="customer"></asp:RequiredFieldValidator>
                                            </div>
                                        </div>
                                        <div class="seperator_form">
                                        </div>
                                        <div>
                                            <div class="form_col_1 comp left tx_form">
                                                <%=GetGlobalResourceObject("Menu", "NewPassword")%></div>
                                            <div class="form_col_2 left">
                                                <asp:TextBox ID="txtNewPassword" TextMode="Password" runat="server" MaxLength="20"
                                                    Width="230px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvNewPassword" runat="server" ControlToValidate="txtNewPassword"
                                                    validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                                    ValidationGroup="customer"></asp:RequiredFieldValidator>
                                            </div>
                                        </div>
                                        <div class="seperator_form">
                                        </div>
                                        <div>
                                            <div class="form_col_1 comp left tx_form">
                                                <%=GetGlobalResourceObject("Menu", "ConfirmPassword")%></div>
                                            <div class="form_col_2 left">
                                                <asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server" MaxLength="20"
                                                    Width="230px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="rfvConfirmPassword" runat="server" ControlToValidate="txtConfirmPassword"
                                                    validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                                    ValidationGroup="customer"></asp:RequiredFieldValidator>
                                                <asp:CompareValidator ID="csvConfirmPassword" runat="server" ControlToCompare="txtNewPassword"
                                                    validationErrorCssClass="validationError" ControlToValidate="txtConfirmPassword"
                                                    Display="Dynamic" ErrorMessage="" Text="" ValidationGroup="customer"></asp:CompareValidator>
                                            </div>
                                        </div>
                                        <div class="seperator_form">
                                        </div>
                                        <div>
                                            <div class="form_col_1 comp left tx_form">
                                                <%=GetGlobalResourceObject("Menu", "SecurityCheck")%></div>
                                            <div class="form_col_2 left">
                                                <asp:UpdatePanel runat="server" ID="uplCAPCHA">
                                                    <ContentTemplate>
                                                        <div style="display: block; float: left;">
                                                            <asp:Image ID="imgCAPTCHA" ImageUrl="/captcha/frmJpegImage.aspx" runat="server" AlternateText="captcha" />
                                                        </div>
                                                        <asp:ImageButton ID="btnNewImage" runat="server" OnClick="btnNewImage_Click" ImageUrl="/images/icon/refresh.gif"
                                                            ToolTip="Reload" AlternateText="Refresh" />
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                                <asp:UpdateProgress AssociatedUpdatePanelID="uplCAPCHA" DisplayAfter="100" runat="server"
                                                    ID="udpCAPTCHA">
                                                    <ProgressTemplate>
                                                        <img src="/images/loading7.gif" alt="Loading..." width="30" height="20" /><br />
                                                    </ProgressTemplate>
                                                </asp:UpdateProgress>
                                            </div>
                                        </div>
                                        <div class="seperator_form">
                                        </div>
                                        <div>
                                            <div class="form_col_1 comp left tx_form">
                                                <%=GetGlobalResourceObject("Menu", "TextinBox")%></div>
                                            <div class="form_col_2 left">
                                                <asp:UpdatePanel ID="uplSecurityCode" runat="server">
                                                    <ContentTemplate>
                                                        <span class="indicator">
                                                            <asp:TextBox ID="txtSecurityCode" runat="server" Width="230" Height="40"></asp:TextBox>
                                                            <asp:RequiredFieldValidator ID="rfvSecurityCheck" runat="server" ControlToValidate="txtSecurityCode"
                                                                validationErrorCssClass="validationError" Display="Dynamic" ErrorMessage="" Text=""
                                                                ValidationGroup="customer"></asp:RequiredFieldValidator>
                                                        </span>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </div>
                                        </div>
                                        <div class="seperator_form">
                                        </div>
                                        <div class="seperator_15px">
                                        </div>
                                        <div>
                                            <div class="form_col_1 left">
                                                &nbsp;
                                            </div>
                                            <div class="form_col_2 left">
                                                <asp:Button ID="btnSubmit" CssClass="button_changepassword" runat="server" OnClientClick="LoadValidationErrorCss();if (Page_ClientValidate('customer')){this.className = 'button_w_processing';}"
                                                    OnClick="btnSubmit_Click" Text="<%$ Resources:Menu,ChangePassword%>" ValidationGroup="customer" />
                                            </div>
                                        </div>
                                    </asp:Panel>
                                    <!--Form | End-->
                                </div>
                            </div>
                        </div>
                        <div class="bottom">
                        </div>
                    </div>
                    <!--Column Content | End-->
                    <!--Column Right | Start-->
                    <div>
                        <div class="col_right-white">
                            <div class="topcol">
                            </div>
                            <div class="body text_center">
                                <div class="tip">
                                    <asp:HyperLink runat="server" ID="hplGetQuote" ToolTip="<%$ Resources:Menu,GetACarInsuranceQuote%>"
                                            NavigateUrl="~/car-insurance/car-details.aspx">                                
                                    <asp:Image ID="Image1" runat="server" ImageUrl="<%$Resources:ImageResource,OfferBannerUrl1%>"
                                        Width="234" Height="188" AlternateText="Payment" />
                                    </asp:HyperLink> 
                                </div>
                            </div>
                            <div class="bottom">
                            </div>
                        </div>
                    </div>
                    <!--Column Right | End-->
                </div>
            </div>
            <div class="bottom">
            </div>
        </div>
    </div>

    <script type="text/javascript">
        function CheckPasswordLength(source, arguments) {
            //var corglen = arguments.Value;
            var cval = arguments.Value;
            var bValid = true;
            var chList = new Array(20);
            var ctrlsource = document.getElementById(source.id);

            //alert("ORG LEN : " + corglen.length + " AFTER : " + cval.length);
            if (cval.indexOf(' ') != -1 || cval.indexOf('\'') != -1
                        || cval.indexOf('\"') != -1 || cval.indexOf('~') != -1) {
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password include invalid character or space!";
                }
                else {
                    ctrlsource.innerText = "Password include invalid character or space!";
                }

                ctrlsource.errormessage = "Password include invalid character or space!";
                bValid = false;
            }
            else if (cval.length < 6) {
                //ctrlsource.innerText = "Password length should be at least 6";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should be at least 6";
                }
                else {
                    ctrlsource.innerText = "Password length should be at least 6";
                }

                ctrlsource.errormessage = "Password length should be at least 6";
                bValid = false;
            }
            else if (cval.length > 20) {
                bValid = false;
                //ctrlsource.innerText = "Password length should not be over 20!";
                if (ctrlsource.textContent) {
                    ctrlsource.textContent = "Password length should not be over 20!";
                }
                else {
                    ctrlsource.innerText = "Password length should not be over 20!";
                }
                ctrlsource.errormessage = "Password length should not be over 20!";
            }
            else {
                bValid = true;
            }
            //alert(cval);
            //if (isNaN(cval)){
            //    bValid = false;
            //} 


            //alert(bValid);
            arguments.IsValid = bValid;
            return;
        }
        
        
    </script>

</asp:Content>
